package p3.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Tool {
    public static int getSecond(Date start,Date end){
        return (int) (end.getTime()- start.getTime())/1000;
    }

    public static String dateFormat(Date date){
        SimpleDateFormat sdf=new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
        return sdf.format(date);
    }

    public static int getParkingCost(int time){
        int money=0;
        if (time>10&&time<30){
            money=time-10;
        }else if (time>=30){
            money=20;
        }
        return money;
    }
}
